# Soccer Makefile
# 
# Make shared, static or debug targets.
# 
# Distribution: GPL 

OS := $(shell uname)
OBJ = build
OBJ2 = dsa
TARGET = game
RENAME = install_name_tool
GNATMAKE = gnatmake -D $(OBJ)
PO_GNATDIST = po_gnatdist
CARGS = -cargs -O3 -gnatp -gnatwu
BARGS = -bargs
LARGS = -largs
VERBOSE = -v
SHARED = libgnat-4.3.dylib
ADA_LIB ?= /usr/local/ada-4.3/lib
.PHONEY: clean cleaner dist-clean tar

all: dist


help:
	@echo ""
	@echo "Soccer build:"
	@echo ""
	@echo "    dist    	  Link the Ada libraries for distributed system."	
	@echo ""
	@echo "Support targets:"
	@echo ""
	@echo "    clean      Remove *.ali *.o b~.*"
	@echo "    cleaner    Remove target, too."
	@echo "    distclean  Remove other directories, too."
	@echo "    tar        Build a clean distribution tarball."
	@echo ""

dist: $(OBJ)
dist: INCLUDE = $(shell gtkada-config --cflags)
dist: BARGS += -shared
dist: LARGS += $(shell gtkada-config --libs)
dist: LARGS += -dead_strip
dist: *.ad[sb]
dist:
	$(PO_GNATDIST) Dist_Soccer.cfg $(INCLUDE) $(CARGS) $(BARGS) $(LARGS)

$(OBJ):
	mkdir $(OBJ)

clean:
	${RM} $(OBJ)/* b~* *.ali *.o

cleaner: clean
	${RM} $(TARGET)

distclean: cleaner
	${RM} -rf $(OBJ)
	${RM} -rf $(OBJ2)
	${RM} -rf bin

tar: distclean
ifeq ($(OS), Darwin)
	(export COPYFILE_DISABLE=true; \
	tar --exclude '.svn' -zcvf soccer.tgz ../src)
else
	tar --exclude '.svn' -zcvf soccer.tgz ../src
endif
